﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>TreeGrid 树形表格</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" /><link href="../demo.css" rel="stylesheet" type="text/css" />

    <script src="../../scripts/boot.js" type="text/javascript"></script>
    
</head>
<body>
    <h1>TreeGrid 过滤</h1>
    <input type="text" id="text" />
    <input type="button" value="过滤" onclick="filter()" style="margin-left:30px;font-weight:bold;"/>
    <ul id="tree1" class="mini-tree" url="../data/TreeService.jsp?method=LoadTree" style="width:300px;height:300px;padding:5px;" 
        showTreeIcon="true" textField="name" expandOnLoad="0" allowDrag="true" allowDrop="true" allowLeafDropIn="true"
        idField="id" parentField="pid" resultAsTree="false"
            >        
    </ul>

</body>
</html>
<script type="text/javascript">
mini.parse();

function filter(){
    var tree = mini.get("tree1")

    var text = document.getElementById("text").value;
    
    var msgid = mini.loading("数据查询中，请稍后......");
    $.ajax({
        url: "../data/TreeService.jsp?method=FilterTree",
        data: { name: text },
        type: "post",
        success: function (text) {
            var data = mini.decode(text);
            tree.loadList(data);
            tree.expandAll();
            mini.hideMessageBox(msgid);
        },
        error: function (jqXHR, textStatus, errorThrown) {
            alert(jqXHR.responseText);
        }
    });
}
</script>